home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <dos/dosextens.h>
- #include <workbench/startup.h>
- #ifdef __GNUC__
- #include <inline/dos.h>
- #endif
-
- extern struct WBStartup *_WBenchMsg;
- extern FILE *stdin,*stdout,*stderr;
-
- void __initstdio(void)
- {
- BPTR window;
- if(_WBenchMsg!=NULL)
- {
- if((window=Open("CON:\\AUTO",MODE_NEWFILE))==NULL)
- exit(RETURN_FAIL);
- SelectInput(window);
- SelectOutput(window);
- }
- stdin->file=Input();
- stdout->file=Output();
- if((stderr->file=((struct Process *)FindTask(NULL))->pr_CES)==NULL)
- stderr->file=stdout->file;
- }
-
- void __exitstdio(void)
- {
- if(_WBenchMsg!=NULL)
- {
- Flush(stdin->file);
- Close(stdin->file);
- }
- }
-